# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Sven Kauber <celeon@gmail.com>

pkgname=bwm-ng
pkgver=0.6.3
pkgrel=2
pkgdesc="A small and simple console-based live bandwidth monitor"
arch=('loong64' 'x86_64')
url="https://www.gropp.org/?id=projects&sub=bwm-ng"
license=('GPL')
depends=('ncurses')
#source=("https://www.gropp.org/bwm-ng/${pkgname}-${pkgver}.tar.gz")
source=("$pkgname-$pkgver.tgz::https://github.com/vgropp/bwm-ng/archive/v${pkgver}.tar.gz"
         https://github.com/vgropp/bwm-ng/commit/6a2087db.patch)
md5sums=('eb343c2b806c5e9a40611fc39e907a3d'
         '8fcb3755290610c5ba5c31e976d6a212')

prepare() {
  cd ${pkgname}-${pkgver}
  patch -p1 < ../6a2087db.patch # Fix build with -Wformat-security
}

build() {
  cd ${pkgname}-${pkgver}
  ./autogen.sh
  ./configure --prefix=/usr --mandir="$pkgdir/usr/share/man"
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make prefix="$pkgdir" install

  install -d "$pkgdir/usr"
  mv "$pkgdir/bin" "$pkgdir/usr/"
}
